package org.example.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.bean.Alipay;
import org.example.service.AlipayService;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:Liu
 * @Testname:AlipayController
 * @Date:2025/8/23 15:23
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/alipay")
public class AlipayController {
    @Resource
    private AlipayService alipayService;

    private Alipay alpay;

    @PostMapping("/pay")
    public String pay(Alipay alipay) {
        this.alpay = alipay;
        return alipayService.pay(alipay);
    }

    @GetMapping("/success")
    public JsonResult success() {
        return alipayService.query(this.alpay);
    }
}
